<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Mail\Message;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;

class NotaiceJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $notice;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($noticeInfo)
    {
        //获取传递的对象 根据 用户内容 在 handle 进行 短信 邮箱等一些列操作
        $this->notice=$noticeInfo;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //此处可以确定时间
        sleep(3);  //sleep  5秒过后执行

        //邮件写在这 不知道为啥不好使
        Log::info('3'."$this->notice");
    }
}
